//
//  CustomNewsShowMergView.m
//  AmountBody
//
//  Created by smm on 2018/1/19.
//  Copyright © 2018年 RCMTM. All rights reserved.
//

#import "CustomNewsShowMergView.h"


@implementation CustomNewsShowMergView
-(instancetype)init
{
    self = [super init];
    if (self) {
        _View_one = [[CustomNewsShowView alloc]init];
        [self addSubview:_View_one];
        _View_two = [[CustomNewsShowView alloc]init];
        [self addSubview:_View_two];
        _View_three = [[CustomNewsShowView alloc]init];
        [self addSubview:_View_three];
        _View_four = [[CustomNewsShowView alloc]init];
        [self addSubview:_View_four];
        _View_five = [[CustomNewsShowView alloc]init];
        [self addSubview:_View_five];
    }
    return self;
}
#pragma mark - 懒加载
- (NSMutableArray *)newsArray;
{
    if (!_newsArray) {
        _newsArray = [[NSMutableArray array]init];
        NSArray * nameArr = [NSArray arrayWithObjects:@"客户昵称：",@"客户名称：",@"身高：",@"体重：",@"电话：",@"客户单号：",@"邮箱：",@"备注：", nil];
        NSArray * valueArr = [NSArray arrayWithObjects:@"客户昵称value",@"客户名称value",@"身高value",@"体重value",@"电话value",@"客户单号value",@"邮箱value",@"备注value备注value备注value备注value备注value备注value", nil];
        for (int i=0; i<nameArr.count; i++) {
            EssentialModel * model =[[EssentialModel alloc]init
                                     ];
            model.name = [nameArr objectAtIndex:i];
            model.value = [valueArr objectAtIndex:i];
            [_newsArray addObject:model];
        }
    }
    return _newsArray;
}
-(void)loadUIForShowMergeView
{
    CGFloat jianGeW = 30;
    CGFloat jianGe = jianGeW*3/2.0;
    CGFloat view_H = 40;
    
    _View_one.l_model = [self.newsArray objectAtIndex:0];
    _View_one.r_model = [self.newsArray objectAtIndex:1];
    _View_one.showType  =ShowTypeForLeftAndRight;
    [_View_one mas_remakeConstraints:^(MASConstraintMaker *make) {
        make.left.equalTo(@(jianGeW));
        make.top.equalTo(self).offset(10);
        make.width.equalTo(self).multipliedBy(0.5).offset(-jianGe);
        make.height.equalTo(@(view_H));
    }];
    [_View_one loadUIForShowView];
    
    _View_two.l_model = [self.newsArray objectAtIndex:2];
    _View_two.r_model = [self.newsArray objectAtIndex:3];
    _View_two.showType  =ShowTypeForLeftAndRight;
    [_View_two mas_remakeConstraints:^(MASConstraintMaker *make) {
        make.right.equalTo(@(-jianGeW));
        make.top.equalTo(self);
        make.width.equalTo(self).multipliedBy(0.5).offset(-jianGe);
        make.height.equalTo(@(view_H));
    }];
    [_View_two loadUIForShowView];
    
    _View_three.l_model = [self.newsArray objectAtIndex:4];
    _View_three.r_model = [self.newsArray objectAtIndex:5];
    _View_three.showType  =ShowTypeForLeftAndRight;
    [_View_three mas_remakeConstraints:^(MASConstraintMaker *make) {
        make.left.equalTo(@(jianGeW));
        make.top.equalTo(_View_one.mas_bottom);
        make.width.equalTo(self).multipliedBy(0.5).offset(-jianGe);
        make.height.equalTo(@(view_H));
    }];
    [_View_three loadUIForShowView];
    
    _View_four.l_model = [self.newsArray objectAtIndex:6];
    _View_four.showType  =ShowTypeForLeft;
    [_View_four mas_remakeConstraints:^(MASConstraintMaker *make) {
        make.right.equalTo(@(-jianGeW));
        make.top.equalTo(_View_one.mas_bottom);
        make.width.equalTo(self).multipliedBy(0.5).offset(-jianGe);
        make.height.equalTo(@(view_H));
    }];
    [_View_four loadUIForShowView];
    
    _View_five.l_model = [self.newsArray objectAtIndex:7];
    _View_five.showType  =ShowTypeForLeft;
    _View_five.hidden = NO;
    [_View_five mas_remakeConstraints:^(MASConstraintMaker *make) {
        make.left.equalTo(@(jianGeW));
        make.top.equalTo(_View_three.mas_bottom);
        make.width.equalTo(self).offset(-jianGeW*2);
        make.height.equalTo(@(view_H));
    }];
    [_View_five loadUIForShowView];
    
}

-(void)loadUIForShowMergeViewHorizontal
{
    CGFloat jianGeW = 30;
    CGFloat view_H = 40;
    
    _View_one.l_model = [self.newsArray objectAtIndex:0];
    _View_one.r_model = [self.newsArray objectAtIndex:1];
    _View_one.showType  =ShowTypeForLeftAndRight;
    [_View_one mas_remakeConstraints:^(MASConstraintMaker *make) {
        make.left.equalTo(@(jianGeW));
        make.right.equalTo(@(-jianGeW));
        make.top.equalTo(self).offset(10);
        
        make.height.equalTo(@(view_H));
    }];
    [_View_one loadUIForShowView];
    
    _View_two.l_model = [self.newsArray objectAtIndex:2];
    _View_two.r_model = [self.newsArray objectAtIndex:3];
    _View_two.showType  =ShowTypeForLeftAndRight;
    [_View_two mas_remakeConstraints:^(MASConstraintMaker *make) {
        make.left.equalTo(@(jianGeW));
        make.right.equalTo(@(-jianGeW));
        make.top.equalTo(_View_one.mas_bottom);
        make.height.equalTo(@(view_H));
    }];
    [_View_two loadUIForShowView];
    
    _View_three.l_model = [self.newsArray objectAtIndex:4];
    _View_three.r_model = [self.newsArray objectAtIndex:5];
    _View_three.showType  =ShowTypeForLeftAndRight;
    [_View_three mas_remakeConstraints:^(MASConstraintMaker *make) {
        make.left.equalTo(@(jianGeW));
        make.right.equalTo(@(-jianGeW));
        make.top.equalTo(_View_two.mas_bottom);
        
        make.height.equalTo(@(view_H));
    }];
    [_View_three loadUIForShowView];
    
    _View_four.l_model = [self.newsArray objectAtIndex:6];
    _View_four.r_model = [self.newsArray objectAtIndex:7];
    _View_four.showType  =ShowTypeForLeftAndRight;
    [_View_four mas_remakeConstraints:^(MASConstraintMaker *make) {
        make.left.equalTo(@(jianGeW));
        make.right.equalTo(@(-jianGeW));
        make.top.equalTo(_View_three.mas_bottom);
        make.height.equalTo(@(view_H));
    }];
    [_View_four loadUIForShowView];
    _View_five.hidden = YES;
}


@end
